package com.yonyou.brigade.order_center.controller;


import com.yonyou.brigade.order_center.model.CnvFlightOrderDO;
import com.yonyou.brigade.order_center.model.CnvHotelOrderDO;
import com.yonyou.brigade.order_center.service.IBriFlightOrderService;
import com.yonyou.brigade.order_center.service.IBriHotelOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jiangzhf@yonyou.com
 * @since 2018-06-14
 */
@Controller
@RequestMapping("/order_center/briHotelOrder")
public class BriHotelOrderController {
    @Autowired
    @Qualifier("briHotelOrderServiceImpl")
    private IBriHotelOrderService briHotelOrderService;

    @RequestMapping(value = "getCnvHotelOrderDos", method = RequestMethod.POST)
    @ResponseBody
    public List<CnvHotelOrderDO> getCnvHotelOrderDos(@RequestBody Map params){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date st = null;
        Date en = null;
        try {
            st = sdf.parse((String) params.get("begin"));
            en = sdf.parse((String) params.get("end"));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        Map pa = new HashMap();
        return briHotelOrderService.getCnvHotelOrderDos(pa, st, en);
    }
}

